﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HeiKiz : MonoBehaviour {

	public Animator animator = null;

	[SerializeField]
	public AnimationCurve animationCurve;  // 动画曲线


	bool isJumping = false;

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	LTDescr ldJump = null;
	public void Jump()
	{
		gameUI.GetInstance ().ShowGuide (false);
		
		if (isJumping)
			return;

		if (Obstacle.obs != null)
			Obstacle.obs.ObstacleBroke ();

		isJumping = true;

		animator.Play ("jump1");


		ldJump = LeanTween.moveLocalY (gameObject, 3f, 1f);
		/*		ld.setEase (LeanTweenType.easeOutCubic);
		ld.setLoopPingPong ();
		ld.setLoopCount (2);*/
		ldJump.animationCurve = animationCurve;

		ldJump.setOnStart (() => {
		
			isJumping= true;
		});


		ldJump.setOnComplete (()=>{
			isJumping = false;
		});

	}

	void OnTriggerEnter2D(Collider2D collider)
	{

	}

}
